Skip to content

Conversation

@InvincibleRMC
Copy link
Contributor

Fixes #17394

(Explain how this PR changes mypy.)

Updates stubdoc is_valid_type regex.

@InvincibleRMC InvincibleRMC changed the title Fix Tuple Special Case from Docstrings Fix Tuple Special Cases from Docstrings Jun 25, 2024
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.



_TYPE_RE: Final = re.compile(r"^[a-zA-Z_][\w\[\], .\"\']*(\.[a-zA-Z_][\w\[\], ]*)*$")
_TYPE_RE: Final = re.compile(r"^[a-zA-Z_][\w\[\], ().\"\']*(\.[a-zA-Z_][\w\[\], ]*)*$")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So basically this giant regex matches these:

  • a
  • abc
  • a[1], b(2).c
  • a_b.c_d
  • a.b.c

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2024

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Stubgenc] Fails to generate stub for Tuple special cases when using pybind11

2 participants